import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParentVO, ParentForm, ParentQuery } from '@/api/office/parent/types';

/**
 * 查询家长信息列表
 * @param query
 * @returns {*}
 */

export const listParent = (query?: ParentQuery): AxiosPromise<ParentVO[]> => {
  return request({
    url: '/office/parent/list',
    method: 'get',
    params: query
  });
};

export const pageParent = (query?: ParentQuery): AxiosPromise<ParentVO[]> => {
  return request({
    url: '/office/parent/page',
    method: 'get',
    params: query
  });
};

/**
 * 查询家长信息详细
 * @param id
 */
export const getParent = (id: string | number): AxiosPromise<ParentVO> => {
  return request({
    url: '/office/parent/' + id,
    method: 'get'
  });
};

/**
 * 新增家长信息
 * @param data
 */
export const addParent = (data: ParentForm) => {
  return request({
    url: '/office/parent',
    method: 'post',
    data: data
  });
};

/**
 * 修改家长信息
 * @param data
 */
export const updateParent = (data: ParentForm) => {
  return request({
    url: '/office/parent',
    method: 'put',
    data: data
  });
};

/**
 * 删除家长信息
 * @param id
 */
export const delParent = (id: string | number | Array<string | number>) => {
  return request({
    url: '/office/parent/' + id,
    method: 'delete'
  });
};
